| File: RecordDefinition\VectorStoreVectorProperty{TInput}.cs | |
| Project: ..\..\..\src\Libraries\Microsoft.Extensions.VectorData.Abstractions\Microsoft.Extensions.VectorData.Abstractions.csproj (Microsoft.Extensions.VectorData.Abstractions) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.AI; using Microsoft.Extensions.VectorData.ProviderServices; using Microsoft.Shared.DiagnosticIds; namespace Microsoft.Extensions.VectorData; /// <summary> /// Defines a vector property on a vector store record. /// </summary> /// <typeparam name="TInput">The input type for embedding generation.</typeparam> /// <remarks> /// <para> /// The characteristics defined here influence how the property is treated by the vector store. /// </para> /// <para> /// This generic version of <see cref="VectorStoreVectorProperty"/> only needs to be used when an <see cref="IEmbeddingGenerator"/> is /// configured on the property, and a custom .NET type is used as input (any type other than <see cref="string"/> or <see cref="DataContent"/>). /// </para> /// </remarks> public class VectorStoreVectorProperty<TInput> : VectorStoreVectorProperty { /// <inheritdoc /> public VectorStoreVectorProperty(string propertyName, int dimensions) : base(propertyName, typeof(TInput), dimensions) { } [Experimental(DiagnosticIds.Experiments.VectorDataProviderServices, UrlFormat = DiagnosticIds.UrlFormat)] internal override VectorPropertyModel CreatePropertyModel() => new VectorPropertyModel<TInput>(Name) { Dimensions = Dimensions, IndexKind = IndexKind, DistanceFunction = DistanceFunction, EmbeddingGenerator = EmbeddingGenerator }; }